import request from '@/utils/request'

// 查询科室管理列表
export function listDepartment(query) {
  return request({
    url: '/hospital/department/list',
    method: 'get',
    params: query
  })
}

export function allListDepartment(query) {
  return request({
    url: '/hospital/department/queryAll',
    method: 'get',
    params: query
  })
}

export function queryAllOnlyByHospitalId(hospitalId) {
  return request({
    url: '/hospital/department/queryAllOnlyByHospitalId/' + hospitalId,
    method: 'get'
  })
}

export function allOptionDepartment(query) {
  return request({
    url: '/hospital/department/option',
    method: 'get',
    params: query
  })
}

// 需要传递公司名称的联级菜单
export function allOptionDepartmentNeedcompany(query) {
  return request({
    url: '/hospital/department/queryAll',
    method: 'get',
    params: query
  })
}

export function optionDepartmentNoLimit(query) {
  return request({
    url: '/hospital/department/optionWithoutPermission',
    method: 'get',
    params: query
  })
}

// 查询科室管理详细
export function getDepartment(departmentId) {
  return request({
    url: '/hospital/department/' + departmentId,
    method: 'get'
  })
}

// 新增科室管理
export function addDepartment(data) {
  return request({
    url: '/hospital/department',
    method: 'post',
    data: data
  })
}

// 修改科室管理
export function updateDepartment(data) {
  return request({
    url: '/hospital/department',
    method: 'put',
    data: data
  })
}

// 删除科室管理
export function delDepartment(departmentId) {
  return request({
    url: '/hospital/department/' + departmentId,
    method: 'delete'
  })
}

export function getTree() {
  return request({
    url: '/hospital/department/tree',
    method: 'get'
  })
}

// 根据合约id 查所有科室
export function contractToDepartment(contractId) {
  return request({
    url: '/hospital/department/option',
    method: 'get',
    params: {
      contractId,
    }
  })
}
